${page.setTitle("push-center| GOPS")}
<style type="text/css">
    .l-table-edit {}
    .l-table-edit-td{ padding:4px;}
    .l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
</style>
${token()}
<div class="body-pla-content">
 <form action="" method="post" id="groupapp" name="groupapp">
 <input type="hidden" name="id" value="${groupapp.id}"/>
        <table class="l-table-edit" >
            
          <tr>
                <td align="right" >名称：</td>
                <td align="left" >
						<input name="name" type="text" id="name"  maxlength="30" value="${groupapp.name}"  validate="{required:true,maxlength:30}"/>
				</td>
			 </tr> 
            <tr>
                <td align="right" >app_id：</td>
                <td align="left" >
						<input name="appId" type="text" id="appId"  maxlength="30" value="${groupapp.appId}"  validate="{required:true,maxlength:30}"/>
				</td>
			 </tr> 
            <tr>
                <td align="right" >群：</td>
                <td align="left" >
						<input name="groupId" type="text" id="groupId"  maxlength="30" value="${groupapp.groupId}"  validate="{required:true,maxlength:30}"/>
						<input type="hidden" name="appChannelId" id="appChannelId" value="${groupapp.appChannelId}" />
				</td>
			 </tr> 
			 
            <tr>
                <td align="right" >外部群id：</td>
                <td align="left" >
						<input name="relativeGroupId" type="text" id="relativeGroupId"  maxlength="30" value="${groupapp.relativeGroupId}"  validate="{required:true,maxlength:30}"/>
				</td>
			 </tr> 
			 
             <tr>
				 <td align="right" >备注：</td>
                <td align="left">
                <textarea rows="3" cols="40" name="memo" id="memo" ></textarea>
				</td>
            </tr>  
            
            <tr>
            	<td></td>
            	<td > <input type="button" value="修改" id="dosubmit" class="l-button l-button-submit"/>  </td>
            	<td align="left"></td>
            </tr>
        </table>
    </form>
</div>
<script type="text/javascript">

$(function () {
	$("#dosubmit").click(function(){
		var queryString = $('#groupapp').serializeArray();  
	    $.ajax({
	        url: "${appServer}/groupapp/update.json",   
	        data: queryString, 
	        type: "POST",
	        success: function(result) {
	        	if(result.hasError) {
					$.ligerDialog.error(result.message);
	        	}else{
	        		$.ligerDialog.success(result.message);
	        		parent.window.search();
	        		parent.$.ligerDialog.close();
	        		parent.$.ligerDialog.hide();
	        	}
	        }
	    });	
		return true;
	});
});


	//-----------------group-start----------------------------------

 $(function ()
        { 
            $("#groupId").ligerComboBox({
                onBeforeOpen: f_selectContact, width:135
            });
        });
        
        function f_selectContact()
        {
            $.ligerDialog.open({ title: ' ++选择群', name:'winselector',width: 550, height: 400,  url: '${appServer}/group/listall', buttons: [
                { text: '确定', onclick: f_selectContactOK },
                { text: '取消', onclick: f_selectContactCancel }
            ]
            });
            return false;
        }
        function f_selectContactOK(item, dialog)
        {
			var fn = dialog.frame.f_select || dialog.frame.window.f_select; 
            var data = fn(); 
            if (!data)
            {
                alert('请选择行!');
                return;
            }
            $("#groupId").val(data.id);
            dialog.close();
        }
        function f_selectContactCancel(item, dialog)
        {
            dialog.close();
        }
        
        
//-----------------group-end----------------------------------


//-----------------appid-start----------------------------------

 $(function ()
        { 
            $("#appId").ligerComboBox({
                onBeforeOpen: f_selectContact2, width:135
            });
        });
        
        function f_selectContact2()
        {
            $.ligerDialog.open({ title: ' ++选择APP_ID', name:'winselector',width: 550, height: 400,  url: '${appServer}/channel/listall-appid', buttons: [
                { text: '确定', onclick: f_selectContactOK2 },
                { text: '取消', onclick: f_selectContactCancel2 }
            ]
            });
            return false;
        }
        function f_selectContactOK2(item, dialog)
        {
			var fn = dialog.frame.f_select || dialog.frame.window.f_select; 
            var data = fn(); 
            if (!data)
            {
                alert('请选择行!');
                return;
            }
            $("#appId").val(data.appId);
            $("#appChannelId").val(data.id);
            dialog.close();
        }
        function f_selectContactCancel2(item, dialog)
        {
            dialog.close();
        }
        
        
//-----------------appid-end----------------------------------

</script>